(function (global) {
    var userAgent = global.navigator.userAgent.toLowerCase();

    function isChrome() {
        console.log('11111');
        var browser = /\bchrome\b/.test(userAgent);
        isChrome = function () {
            console.log('22222');
            return browser;
        };
        return browser;
    }

    window.browser = browser;
}(window));